package com.dxw.kit.email;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

public class MailAuthenticator extends Authenticator {
	
	String userName = null;
	String password = null;
	
	/**
	 * 无参构造器
	 */
	public MailAuthenticator() {
		
	}
	
	/**
	 * 有参构造器（传入uesrName,password）
	 * @param userName
	 * @param password
	 */
	public MailAuthenticator(String userName, String password) {
		this.userName = userName;
		this.password = password;
	}
	
	/**
	 * 根据userName,password生成PasswordAuthentication。
	 */
	public PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(userName, password);
	}
	
}
